$("#handwriting-page").live("pageshow", function(){
	var touch_canvas = new CanvasDrawr({id: "drawCanvas", size: 5});

	$(".color-box").click(function(){
		var color = $(this).css('background-color');
		alert(color);
		touch_canvas.setColor("'" + color + "'");
	});

	$("#button-select").click(function(){
		var canvas = document.getElementById("drawCanvas");
		var dataImage = canvas.toDataURL("image/png");
		dataImage = dataImage.replace("data:image/png;base64", "");
		$.ajax({
			url: '/app/Image/save_image',
			data: {'data': dataImage},
			type: 'POST',
			success: function(res){
				if (res == "ok"){
					$.mobile.changePage('/app/QADetail/index');
				}
			}
		})
	//alert(dataImage);
		//Display this image on other screen
		
	})
});

$("#conversation-page").live("pageshow", function(){
	$(document).scrollTop($(document).height());
})